﻿using System.Collections.Generic;
using System.Linq;

namespace Tuxedo.Compile
{
	internal class ConstructorDefinition : IFPClassMember 
	{
		private Visibility visibility;
		private bool isStatic;
		private bool hasNextConstructor;
		private bool nextConstructorIsBase;
		private Expression[] nextConstructorArgs;
		private CodeLine[] code;
		private UnverifiedType[] parameterTypes;
		private string[] parameterNames;
		public override MemberAttribute[] Attributes { get { return this.attributes; } }
		private MemberAttribute[] attributes;

		public ConstructorDefinition(
			Visibility visibility,
			bool isStatic,
			bool hasNextConstructor,
			IList<Expression> nextConstructorArgs,
			bool nextConstructorIsBase,
			IList<CodeLine> body,
			IList<string> parameterNames,
			IList<UnverifiedType> parameterTypes,
			IList<MemberAttribute> attributes)
		{
			this.visibility = visibility;
			this.isStatic = isStatic;
			this.hasNextConstructor = hasNextConstructor;
			this.nextConstructorArgs = hasNextConstructor ? nextConstructorArgs.ToArray() : null;
			this.nextConstructorIsBase = nextConstructorIsBase;
			this.code = body.ToArray();
			this.parameterNames = parameterNames.ToArray();
			this.parameterTypes = parameterTypes.ToArray();
			this.attributes = attributes.ToArray();
		}
	}
}
